package com.wing.order.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wing.order.model.entity.CabInventoryProductRecord;
import com.wing.order.model.response.CabInventoryProductRecordVO;
import com.wing.order.model.response.MaterialInventoryStatisticsReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 产品库存变动记录-Dao
 *
 * @author
 */
@Mapper
public interface CabInventoryProductRecordDao extends BaseMapper<CabInventoryProductRecord> {

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<CabInventoryProductRecordVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    List<CabInventoryProductRecordVO> list4app(@Param("page") Page<CabInventoryProductRecordVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    CabInventoryProductRecordVO get4appById(Long id);

    /**
     * 物料库存统计报表
     * @param page
     * @param params
     * @return
     */
    List<CabInventoryProductRecordVO> statisticsReport(@Param("page") Page<CabInventoryProductRecordVO> page, @Param("params") Map<String, Object> params);

    List<CabInventoryProductRecordVO> statisticsReport(@Param("params") Map<String, Object> params);

    /**
     * 查询产品仓库集合
     * @param skuCode
     * @param startCreateTime
     * @return
     */
    List<Long> getWarehouseList(@Param("skuCode") String skuCode, @Param("startCreateTime") String startCreateTime, @Param("endCreateTime") String endCreateTime);

    /**
     * 查询期初数量(基础单位计)
     * @param warehouseId
     * @param skuCode
     * @param startCreateTime
     * @return
     */
    Integer getOpeningQuantity(@Param("warehouseId") Long warehouseId, @Param("skuCode") String skuCode, @Param("startCreateTime") String startCreateTime);

    /**
     * 查询期初数量(包装计)
     * @param warehouseId
     * @param skuCode
     * @param startCreateTime
     * @return
     */
    Integer getOpeningPackQuantity(@Param("warehouseId") Long warehouseId, @Param("skuCode") String skuCode, @Param("startCreateTime") String startCreateTime);

    /**
     * 查询结存数量(基础单位计)
     * @param warehouseId
     * @param skuCode
     * @param endCreateTime
     * @return
     */
    Integer getBalanceQuantity(@Param("warehouseId") Long warehouseId, @Param("skuCode") String skuCode, @Param("endCreateTime") String endCreateTime);

    /**
     * 查询结存数量(包装计)
     * @param warehouseId
     * @param skuCode
     * @param endCreateTime
     * @return
     */
    Integer getBalancePackQuantity(@Param("warehouseId") Long warehouseId, @Param("skuCode") String skuCode, @Param("endCreateTime") String endCreateTime);

    /**
     * 导出
     * @param params
     * @return
     */
    List<MaterialInventoryStatisticsReportVO> export(@Param("params") Map<String, Object> params);
}
